<script setup>
import {ref,onMounted} from 'vue'
import http from '@/utils/http.js'

const params={
    key:"b473a1f7c46d8519e14e01b742a1d495",
    city:"金华",
}

const weatherData=ref(null)
const getWeather=async()=>{
    const response=await http.get('/simpleWeather/query',{params });
    weatherData.value=response.result.realtime;
}

onMounted(()=>{
    getWeather();

});
</script>

<template>
<div>
    <h3>金华天气</h3>
    <div v-if="weatherData">
        <p>温度:{{ weatherData.temperature }}</p>
        <p>温度:{{ weatherData.humidity }}</p>
        <p>空气质量:{{ weatherData.aqi }}</p>
    </div>
</div>
</template>